
import java.util.ArrayList;

public class Movie  
{
	String moviename;
	ArrayList<Customer> customerList=new ArrayList<Customer>() ;
	Barrier barrier=new Barrier(10,this);
	Boolean isWatched=false;
	Theater theater;

 
	public Movie( String moviename ,Customer firstCustomer ,Theater theater)
	{
		this.moviename = moviename;
		addSpectator1(firstCustomer);
		this.theater=theater;
	}
  
 
	public boolean isFull()
	{
		if( customerList.size() >= 10 )
			return true;
		return false;
	}

	public synchronized boolean startMov(Customer customer)
	{
		if(customerList.size()==10){
			customer.theater.Printer(customer+"  is watching"+" "+ moviename);
			return true;
			}return false;
	}
	
	public synchronized void addSpectator( Customer customer )
	{
		if( customerList.size() < 10 )
			customerList.add( customer );
		
		customer.bookedMovie=this;
		 
		customer.theater.Printer(customer.customerid+" has booked "+this.moviename);
 
	
	}
	
	public synchronized void addSpectator1( Customer customer )
	{
			if( customerList.size() < 10 )
				customerList.add( customer );
			
			customer.bookedMovie=this;
			 
			customer.theater.Printer(customer.customerid+" has started "+this.moviename);
	}
	
 
 
 
}
 
